<!doctype html><html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <div class="datalist"><table id="flexigrid" style="display:none"></table></div>
        <script type="text/javascript">
            $(function() {
                $("#flexigrid").flexigrid($.extend(SG.flexOptions, {
                    url: '<?= site_url('general/language/flexigrid') ?>',
                    colModel: [
                        {display: 'ID', name: 'id', width: '10%', iskey: true},
                        {display: '<?= translate('GENERAL_LANGUAGE_FILENAME') ?>', name: 'name', width: '10%'},
                        {display: '<?= translate('SIZE') ?>', name: 'size', width: '15%'},
                        {display: '<?= translate('CREATETIME') ?>', name: 'atime', width: '15%'},
                        {display: '<?= translate('MODIFYTIME') ?>', name: 'mtime', width: '15%'},
                        {display: '<?= translate('COPY') ?>', name: 'id', width: '5%', sortable: false, process: formatCopy},
                        {display: '<?= translate('MANAGE') ?>', name: 'id', width: '12%', sortable: false, process: formatOp},
                    ],
                    buttons: [
                        {name: 'delete', displayname: "<?= translate('DEL') ?>", title: "<?= translate('DEL') ?>", bclass: 'delete', onpress: multi},
                        {separator: true},
                    ],
                    sortname: "id",
                    sortorder: "asc",
                }));
                SG.admin = $.extend(SG.admin, {
                    edit_url: '<?= site_url("general/language/edit/") ?>',
                    del_url: '<?= site_url("general/language/del/") ?>',
                    multi_url: '<?= site_url("general/language/multi/") ?>',
                    table: ''
                });

                $(".copyit").live("click", function() {
                    $.ajax({
                        url: '<?= site_url("general/language/add/") ?>' + $(this).attr("rel"),
                        type: 'POST',
                        data: {
                            areaIds: $(".multiselect").selectedValuesString()
                        },
                        dataType: 'json',
                        success: function(ret) {
                            if (ret.code == 1) {
                                if (ret.result && ret.result.length >= 4 && typeof ret.result == "object") {
                                    window.top.async(ret.result[0], ret.result[1], ret.result[2], ret.result[3]);
                                }
                                SG.admin.success(LANG.C_TIPS_SUCCESS_TEXT);
                                SG.admin.refresh();
                            } else {
                                SG.admin.failure(ret.result);
                            }
                        },
                        error: function(ret) {
                            SG.admin.failure(ret);
                        }
                    });
                });
            });

            function formatCopy(value, id) {
                return '<a href="javascript:;" class="copyit" rel="' + id + '"><?= translate('COPY') ?></a>';
            }
        </script>
    </body>
</html>